<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$CONF['mallTitle']}后台管理中心</title>
    <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
    <!--[if lt IE 9]>
    <script src="__PUBLIC__/js/html5shiv.min.js"></script>
    <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/common.js"></script>
    <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
    <!--时间日历插件-->
    <script type="text/javascript" src="__PUBLIC__/plugins/jeDate/jedate.js"></script>
    <style type="text/css">
        li{
            list-style-type: none;
        }
        .jedaol{
            padding: 0px;
        }
        .botflex{
            padding: 0px;
        }
    </style>

</head>
<script>
       function toggleIsShow(t,v){
       Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
       $.post("{:U('Admin/Complain/editiIsShow')}",{id:v,isHandle:t},function(data,textStatus){
            var json = WST.toJson(data);
            if(json.status=='1'){
                Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
                    location.reload();
                }});
            }else{
                Plugins.closeWindow();
                Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
            }
       });
   }
    function del(id){
        Plugins.confirm({title:'信息提示',content:'您确定要删除吗?',okText:'确定',cancelText:'取消',okFun:function(){
            Plugins.closeWindow();
            Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
            $.post("{:U('Admin/Complain/del')}",{id:id},function(data,textStatus){
                var json = WST.toJson(data);
                if(json.status=='1'){
                    Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
                        location.reload();
                    }});
                }else{
                    Plugins.closeWindow();
                    Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
                }
            });
        }});
    }

    //导出所选
    function ExportSelected(exportStatus)
    {
        var params = {};
        params.id = '';
        $('input[num="list"]:checked').each(function(i,item){
            params.id += $(this).attr('id')+',';
        });
                //所选
        params.exportStatus = exportStatus;
        var jsonText = JSON.stringify(params);
        location.href="__CONTROLLER__/outExcel/id/"+jsonText;
    }

    function BatchDelete()
    {
        var params = {};
        params.id = '';
        $('input[num="list"]:checked').each(function(i,item){
            params.id += $(this).attr('id')+',';
        });
        Plugins.confirm({title:'信息提示',content:'您确定要删除该投诉吗?',okText:'确定',cancelText:'取消',okFun:function(){
            Plugins.closeWindow();
            Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
            $.post("{:U('Admin/Complain/deletes')}",params,function(data,textStatus){
                var json = WST.toJson(data);
                if(json.status=='1'){
                    Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
                        location.reload();
                    }});
                }else{
                    Plugins.closeWindow();
                    parent.showMsg({msg:'操作失败!',status:'danger'});
                }
            });
        }});
    }

    $(function(){
        //全选
        $("#selected").click(function(){
            $('input[num="list"]').prop('checked',true);
            $('#cancel').attr('checked',false);

        });
        //取消全选
        $("#cancel").click(function(){
            $('input[num="list"]').prop('checked',false);
            $('#selected').attr('checked',false);
        });

    });
</script>
<body class='wst-page'>
<form method='post' action="{:U('Admin/Complain/index')}">
    <div class='wst-tbar'>
        订单号：<input type='text' id='orderNo' name='orderNo' class='form-control wst-ipt-10' value='{$orderNo}'/>
        开始时间:<input class="datainp" id="startTime" name="startTime" type="text" placeholder="请选择" 
          value='{$startTime}'  readonly>
        结束时间:<input class="datainp" id="endTime" name="endTime" type="text" placeholder="请选择" value='{$endTime}'  readonly>
        &nbsp;<button type="submit" class="btn btn-primary glyphicon glyphicon-search">查询</button>
    </div>
</form>
<div class="wst-body">
    <if condition="$list['error'] eq ''">
    <table class="table table-hover table-striped table-bordered wst-list">

        <thead>
        <tr>
            <th width='60'>序号</th>
            <th width='150' style="text-align: center;">订单号</th>
            <th width='150' style="text-align: center;">手机号码</th>
            <th style="text-align: center;">投诉内容</th>
            <th width='150' style="text-align: center;">投诉时间</th>
            <th width='150' style="text-align: center;">操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="data['root']" id="vo" key='i'>
            <tr>
                <td><input type="checkbox"  name="id[]" num="list" id="{$vo.id}"/>{$i}</td>
                <td>{$vo.orderNo}</td>
                <td>{$vo.phone}</td>
                <td>{$vo.content}</td>
                <td>
                    <php>echo date('Y-m-d H:i:s',$vo['time'])</php>
                </td>
                <td>
                    <a class="btn btn-default glyphicon glyphicon-pencil"
                            href="{:U('Admin/Orders/toView',array('id'=>$vo['orderId']))}">查看</a>
                        &nbsp;
                    <a class="btn btn-default glyphicon glyphicon-trash" onclick="javascript:del({$vo['id']})">刪除</button>
                </td>
            </tr>
        </volist>
        <tr>
            <td colspan='8'>
                <input type="checkbox" name="selected" id="selected"/>全选
                <input type="checkbox" name="cancel" id="cancel"/>取消
                <input type="button" onclick="javascript:BatchDelete()" value="批量删除"/>
                <input type="button" onclick="javascript:ExportSelected(0)" value="导出所选"/>
                <input type="button" onclick="javascript:ExportSelected(1)" value="导出全部"/>
                <input type="button" onclick="javascript:ExportSelected(2)" value="导出查询"/>
            </td>
        </tr>
        <tr>
            <td colspan='8' align='center'>{$data['show']}</td>
        </tr>
        </tbody>
    </table>
        <else />
            {$list['error']}
        </if>
</div>
</body>
<script type="text/javascript">
    jeDate({
    dateCell:"#startTime",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:false,
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    okfun:function(val){}
  })
    jeDate({
    dateCell:"#endTime",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:false,
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    okfun:function(val){}
  })
</script>
</html>